package com.hunter.listener;

import javax.swing.*;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

/**
 * @Project:iwms
 * @Description: 键盘监听
 * @Author: Mr.Hunter
 * @Date:2022/7/15/18:41
 */
public class TextFieldKeyListenter implements KeyListener {
    private JTextField orderTextField;

    public TextFieldKeyListenter(JTextField orderTextField) {
        this.orderTextField = orderTextField;

    }

    @Override
    public void keyTyped(KeyEvent e) {

    }

    @Override
    public void keyPressed(KeyEvent e) {
        if(e.getKeyChar() == KeyEvent.VK_ENTER )
        {
            orderTextField.setText("");
        }

    }

    @Override
    public void keyReleased(KeyEvent e) {

    }
}